<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="../css/monokai-sublime.css">
    <link rel="stylesheet" href="../css/note.css">

    <script src="../js/highlight.pack.js"></script>
    <script src="../js/fixHighLight.js"></script>

    <script>

        hljs.initHighlightingOnLoad();

    </script>

    <title>mac卸载Python2.7步骤</title>
</head>
<body onload="replaceCode2ulli();">
<div class="detailTitle">mac卸载Python2.7步骤</div>
<div class="detailContent">

    <h3>背景介绍</h3>
    <p>删除 mac os 自带的 Python 2.7(虽然新版的mac系统里已经移除了Python2)，以方便安装 python 3 的虚拟环境。</p>
    <h3>步骤</h3>
    <p>1. 删除 Python 2.7 framework </p>

    <pre><code class="Bash">
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
    </code></pre>

    <p>2. 删除 Python 2.7 applications directory</p>

    <pre><code class="Bash">
sudo rm -rf "/Applications/Python 2.7"
    </code></pre>

    <p>3. 检查指向 /usr/local/bin 的 python 版本链接</p>

    <pre><code class="Bash">
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7'
    </code></pre>
     
    <p>4.删除版本链接。</p>

    <pre><code class="Bash">
cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm
    </code></pre>
     
    <p>5.手动删除环境变量中Python的配置。</p>

</div>


<div class="note_footer">
    <p><font color=red>&hearts;</font></p>
    <img src="../images/qr.png"></img></div>
</body>
</html>